/** * @license * Copyright 2018 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Oas20SchemaDefinition, Oas30SchemaDefinition, Aai20SchemaDefinition, OasDocument, AaiDocument, Node, OasOperation, OasPathItem, Oas20Schema, Oas30Schema, AaiServer } from "apicurio-data-models"; import { EventEmitter, OnChanges, SimpleChanges } from "@angular/core"; export interface EntityEditorEvent { entity: T; } export interface IEntityEditorHandler> { onSave(event: E): void; onCancel(event: E): void; } /** * Base class for all entity editors. T represents the type of entity being edited. E represents * the event data structure. */ export declare abstract class EntityEditor> { _isOpen: boolean; _mode: string; handler: IEntityEditorHandler; context: OasDocument | OasPathItem | OasOperation | Oas30SchemaDefinition | Oas20SchemaDefinition | AaiDocument | Aai20SchemaDefinition | Oas20Schema | Oas30Schema | AaiServer; entity: T; /** * Called to open the editor. * @param handler * @param context * @param entity */ open(handler: IEntityEditorHandler, context: OasDocument | OasPathItem | OasOperation | Oas30SchemaDefinition | Oas20SchemaDefinition | AaiDocument | Aai20SchemaDefinition | Oas20Schema | Oas30Schema | AaiServer, entity?: T): void; /** * Called at the end of the open() method. Subclasses can override this to perform specific work. */ doAfterOpen(): void; /** * Initializes the editor's data model from a provided entity (initialize the editor data model from an entity). * @param entity */ abstract initializeModelFromEntity(entity: T): void; /** * Initializes the editor's data model to an empty state. */ abstract initializeModel(): void; /** * Returns true if the data model is valid. */ abstract isValid(): boolean; /** * Creates an entity event specific to this entity editor. */ abstract entityEvent(): E; /** * Called to close the dialog. */ close(): void; /** * Called when the user clicks "save". */ save(): void; /** * Called when the user clicks "cancel". */ cancel(): void; /** * Returns true if the dialog is open. */ isOpen(): boolean; /** * @param event */ onKeypress(event: KeyboardEvent): void; /** * Returns true if the context is the document (global). */ isGlobalContext(): boolean; } export declare class EntityEditorComponent implements OnChanges { entityType: string; heading: string; context: OasDocument | OasPathItem | OasOperation | AaiDocument; showRequiredFieldsMessage: boolean; valid: boolean; dirty: boolean; onSave: EventEmitter; onClose: EventEmitter; contextIs: string; protected _expandedContext: any; /** * Called when the @Input changes. * @param changes */ ngOnChanges(changes: SimpleChanges): void; /** * Figures out what the context is based on what is passed to it. * @param context */ expandContext(context: OasDocument | OasPathItem | OasOperation | Oas20SchemaDefinition | Oas30SchemaDefinition | AaiDocument | Aai20SchemaDefinition | Oas20Schema | Oas30Schema): void; /** * Gets the context path item (if any). */ pathItem(): OasPathItem; /** * Gets the context operation (if any). */ operation(): OasOperation; /** * Gets the data type (if any). */ dataType(): Oas20SchemaDefinition | Oas30SchemaDefinition | Aai20SchemaDefinition; /** * Gets the data type name. */ dataTypeName(): string; /** * @param event */ onGlobalKeyDown(event: KeyboardEvent): void; }